6502MachineCodeForHumans by Unknown

6502MachineCodeForHumans by Unknown
Author: Unknown
Format: epub

Calculator Program 69 INX ;zeros with ‘+’ sign E8 INX ;index next register E8 CPX #16 ;repeat for ‘registers’ E0 10 BNE CCIL ;A, B, C and D. DO F7 LDA #0 ;clear operator byte A9 00 STA AMO ;in AMO and set input 85 3D STA AM W ;digit to new number. 85 3E ;validate i nput command, converted to a number. CCLP JSR GETCH ;get key-in in A 20 lo LDX #19 ;index table end byte A2 13 CCGLP CMP CCTAB,X ;loop till input DD lo BEQ CCVCH ;matches or F0 05 DEX ;X goes past start CA BPL CCGLP ;of valid table when 10 F8 BMI CCLP ;go get new input. 30 FI CCVCH TXA ;command number to A 8A LDX #8 ;index ‘register’ A A2 08 ;test for sign change command *#’ , new no. 10. CMP #10 ;branch if C9 0A BNE CCNSC ;not sign change A. DO 08 LDA (0,X) ;get sign byte, change A 1 00 EOR o o o O O o ;+ to — , or — to +, 49 06 STA (0,X) ;replace it and 81 00 BNE CCLP ;get next command. DO E2 ;test for digits, new nos. 0 to 9. Shift digit in. CCNSC BCS CCND ;branch if > 9 on flag B0 13 ORA #$30 ;from last CMP. Put in 09 30 INC AM W ;ASC11 hi-nib. Test for E6 3E BEQ CCDOK ;okay to shift or first F0 03 JSR RCLR ;clear for new number. 20 lo CCDOK JSR RRLD ;feed digit in from 20 lo LDA #-l ;right. Flag current no. A9 FF CCAMW STA AM W ;set/ reset new no. flag 85 3E DEX ;in AM W. Ensure branchCA BNE CCLP ;to get next command. DO CD ;test register move. Get register name. CCND SBC #14 ;X, S and L below zero E9 0E BCS CCNSW ;branch if >= 0. B0 25 CMP #- 2 ;test X, S or L and C9 FE PH P ;save result while 08 CCSLP JSR GETCH ;getting register name. 20 lo CMP “E” ;loop till B, C or D C9 45 BCS CCSLP ;is input. B0 F9 CMP “B” ‘ C9 42 BCC CCSLP ; 90 F5